<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--Rendered using the Haskell Html Library v0.2-->
<HTML
><HEAD
><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"
><TITLE
>Util</TITLE
><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"
><SCRIPT SRC="haddock.js" TYPE="text/javascript"
></SCRIPT
></HEAD
><BODY
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="topbar"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD
><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "
></TD
><TD CLASS="title"
></TD
><TD CLASS="topbut"
><A HREF="index.html"
>Contents</A
></TD
><TD CLASS="topbut"
><A HREF="doc-index.html"
>Index</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="modulebar"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD
><FONT SIZE="6"
>Util</FONT
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
>Description</TD
></TR
><TR
><TD CLASS="doc"
>Utility functions we wish were in the Prelude, but aren't.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
>Synopsis</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="body"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="decl"
><A HREF="#v%3AcountWith"
>countWith</A
> :: (a -&gt; Bool) -&gt; [a] -&gt; Int</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AincreasingByOne"
>increasingByOne</A
> :: (Enum a, Eq a) =&gt; [a] -&gt; Bool</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AcountDups"
>countDups</A
> :: Eq a =&gt; [a] -&gt; [(a, Int)]</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AreadMaybe"
>readMaybe</A
> :: Read a =&gt; String -&gt; Maybe a</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3Areplace"
>replace</A
> :: Int -&gt; a -&gt; [a] -&gt; [a]</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AmaybeM"
>maybeM</A
> :: Monad m =&gt; (a -&gt; m b) -&gt; Maybe a -&gt; m (Maybe b)</TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
>Documentation</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v%3AcountWith"
></A
><B
>countWith</B
> :: (a -&gt; Bool) -&gt; [a] -&gt; Int</TD
></TR
><TR
><TD CLASS="doc"
>Count the number of elements in a list satisfying a predicate.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v%3AincreasingByOne"
></A
><B
>increasingByOne</B
> :: (Enum a, Eq a) =&gt; [a] -&gt; Bool</TD
></TR
><TR
><TD CLASS="doc"
>Check that the list contains elements where one is the successor of the 
  last.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v%3AcountDups"
></A
><B
>countDups</B
> :: Eq a =&gt; [a] -&gt; [(a, Int)]</TD
></TR
><TR
><TD CLASS="doc"
>Count the number of duplicate entries in a list and return a list of tuples
  (element, # of duplicates).
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v%3AreadMaybe"
></A
><B
>readMaybe</B
> :: Read a =&gt; String -&gt; Maybe a</TD
></TR
><TR
><TD CLASS="doc"
>Attempt to parse a String, returning Nothing if the parse fails.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v%3Areplace"
></A
><B
>replace</B
> :: Int -&gt; a -&gt; [a] -&gt; [a]</TD
></TR
><TR
><TD CLASS="doc"
>Replace the nth element of a list with the given element.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v%3AmaybeM"
></A
><B
>maybeM</B
> :: Monad m =&gt; (a -&gt; m b) -&gt; Maybe a -&gt; m (Maybe b)</TD
></TR
><TR
><TD CLASS="doc"
>Perform monadic action if Maybe has a value, otherwise return unit.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="botbar"
>Produced by <A HREF="http://www.haskell.org/haddock/"
>Haddock</A
> version 0.8</TD
></TR
></TABLE
></BODY
></HTML
>
